package com.apexedu.sys.action;

import com.apexedu.framework.service.BaseService;
import com.apexedu.sys.entity.ApplicationEnum;
import com.apexedu.sys.entity.TSysReportfactory;
import com.apexedu.sys.service.impl.ExcelImportAdminSetupServiceImpl;
import com.apexedu.sys.service.impl.ReportFactorybaseServiceImpl;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.io.File;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("serial")
@Component
@Scope("prototype")
public class ReportFactorybaseAction extends AbstractBaseActionSupport {
	
	@Resource(name="reportFactorybaseService")
	public void setBaseService(BaseService baseService){
		super.setBaseService(baseService);
	}
	
	private TSysReportfactory tsysReportfactory;

	private File photo;

	private String photoContentType;

	private String photoFileName;

	public File getPhoto() {
		return photo;
	}
	public void setPhoto(File photo) {
		this.photo = photo;
	}
	public String getPhotoContentType() {
		return photoContentType;
	}
	public void setPhotoContentType(String photoContentType) {
		this.photoContentType = photoContentType;
	}
	public String getPhotoFileName() {
		return photoFileName;
	}
	public void setPhotoFileName(String photoFileName) {
		this.photoFileName = photoFileName;
	}

	public TSysReportfactory getTsysReportfactory() {
		return tsysReportfactory;
	}

	public void setTsysReportfactory(TSysReportfactory tsysReportfactory) {
		this.tsysReportfactory = tsysReportfactory;
	}


	public void addreport(){
		ReportFactorybaseServiceImpl service = new ReportFactorybaseServiceImpl();
		String id=getRequest().getParameter("id");
		String location=getRequest().getParameter("location");
		String msg=service.addreport(id,location, this);
		//String msg = service.DeleteImage(imagename,url,this);
		putResultStringToView(msg);
	}

	public void delreport(){
		ReportFactorybaseServiceImpl service = new ReportFactorybaseServiceImpl();
		String location=getRequest().getParameter("location");
		String msg=service.delreport(location, this);
		putResultStringToView(msg);
	}

	public void removePic(){
		ReportFactorybaseServiceImpl service = (ReportFactorybaseServiceImpl)getBaseService();
		boolean success = service.removePic(this);
		putResultStringToView(success?"ok":"删除失败！");//直接返回字符串，不需要视图了。客户端AJAX
	}
}
